import DS from 'ember-data';
import BaseModel from './base-model';

export default BaseModel.extend({
  dateService: Ember.inject.service("date-service"),
  lastUpdateUser:DS.belongsTo('user'),//更新操作者userid
  createUser:DS.belongsTo('user'),//创建者
  createDateTime:DS.attr('number'),//创建时间
  lastUpdateDateTime:DS.attr('number'),//更新时间
  remark:DS.attr('string'),//备注
  name:DS.attr("string"),//职位名称
  salaryAmount:DS.attr('number'),//职位薪资
  isAdmin:DS.attr('string'),//默认为0,1代表管理员

  createDateTimeStr:Ember.computed("createDateTime",function(){
    var createDateTime = this.get("createDateTime");
    return this.get("dateService").formatDate(createDateTime,"yyyy-MM-dd hh:mm");
  }),

  lastUpdateDateTimeStr:Ember.computed("lastUpdateDateTime",function(){
    var lastUpdateDateTime = this.get("lastUpdateDateTime");
    return this.get("dateService").formatDate(lastUpdateDateTime,"yyyy-MM-dd hh:mm");
  }),

});
